home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Icon / c / DisposeInd < prev    next >
Text File  |  1995-07-08  |  2KB  |  47 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Icons.DisposeInd.c
  12.     Author:  Copyright © 1993 (Tim Browse)
  13.     Version: 1.00 (27 Mar 1993)
  14.     Purpose: Dispose indirected data space used by an icon. Note that this
  15.              data must have been allocated with malloc() originally.
  16. */
  17.  
  18. #include <stdlib.h>
  19.  
  20. #include "DeskLib:Wimp.h"
  21. #include "DeskLib:Icon.h"
  22.  
  23.  
  24. extern void Icon_DisposeIndData(icon_data *data, icon_flags flags)
  25. {
  26.   /* make sure this icon is indirected - exit quietly if not */
  27.   if ((data == NULL) || (!flags.data.indirected))
  28.     return;
  29.  
  30.   if (!flags.data.text && flags.data.sprite)             /* Sprite only icon */
  31.   {
  32.     if (data->indirectsprite.nameisname)
  33.       free((void *) data->indirectsprite.name);
  34.     return;
  35.   }
  36.  
  37.   if (flags.data.text || flags.data.sprite)        /* Text/Text&Sprite icon */
  38.   {
  39.     free(data->indirecttext.buffer);
  40.  
  41.     /* Free validation string, if there is one */
  42.     if ((data->indirecttext.validstring != NULL) &&
  43.         (data->indirecttext.validstring != (char *) 0xffffffff))
  44.       free(data->indirecttext.validstring);
  45.   }       
  46. }
  47.